import request from './request';

// 获取轮播图
export const reqGetLunbo = () => {
  return request({
    url: '/api/getlunbo',
  });
};

// 获取推荐商品
export const reqRecommendGoods = (page = 1, pagesize = 10) => {
  return request({
    url: `/api/recommend`,
    data: { page, limit: pagesize },
  });
};

// 获取商品分类
export const reqCategory = () => {
  return request({
    url: `/api/getcategory`,
  });
};

// 获取分类下面的商品
export const reqCategoryGoods = (category_id) => {
  return request({
    url: `/api/getcategorygoods`,
    data: { category_id },
  });
};

// 获取搜索商品
export const reqSearchGoods = ({ value, sort, page = 1, pagesize = 10 }) => {
  console.log('value', value);
  return request({
    url: `/api/search`,
    data: { value, sort, page, pagesize },
  });
};

// 获取新闻列表
export const reqNewsList = ({ page = 1, pagesize = 10 }) => {
  return request({
    url: `/api/getnewslist`,
    data: { page, pagesize },
  });
};

// 获取商品轮播图数据
export const reqGoodsThumbImage = (id) => {
  return request({
    url: `/api/getthumbimages/${id}`,
  });
};

// 获取商品的基本信息
export const reqGoodsInfo = (id) => {
  return request({
    url: `/api/getgoodsinfo/${id}`,
  });
};
